package com.p2p.auth.common.utils;

import java.util.Arrays;
import java.util.List;

/**
 * 时间工具类
 * 
 * @author pansenxin
 * @date 2014-03-27
 */
public class DataChangeUtils {

	/**
	 * string to list
	 * @param strs
	 * @return
     */
	public static List<String> stringToList(String strs){
		String str[] = strs.split(",");
		return Arrays.asList(str);
	}

	/**
	 * list集合转string，使用stringbuilder拼接
	 * @param list
	 * @return
     */
	public static String listToString(List<String> list) {
		if (list == null) {
			return null;
		}
		StringBuilder result = new StringBuilder();
		boolean first = true;
		//第一个前面不拼接","
		for (String string : list) {
			if (first) {
				first = false;
			} else {
				result.append(",");
			}
			result.append(string);
		}
		return result.toString();
	}
}
